"""
@File    : decorator.py
@Time    : 2021/10/29 0:46
@Author  : chenhuayan
@Software: PyCharm
"""


# !/usr/bin/env python3
# -*- coding: utf-8 -*-
class SingletonDecorator:
    def __init__(self, cls):
        self.cls = cls
        self.instance = None

    def __call__(self, *args, **kwargs):
        if self.instance is None:
            self.instance = self.cls(*args, **kwargs)
        return self.instance
